import os
import xlwt

BASE_DIR = os.path.dirname(__file__)


class ExcelOp(object):

    def __init__(self, ex_file):
        self.ex_file = ex_file
        self.wb = xlwt.Workbook()

    def excel_run(self):
        sheet = self.wb.add_sheet('sheet 1')
        sheet.write(0, 0, 'test data')

        self.wb.save(self.ex_file)


if __name__ == '__main__':
    ex_name = 'test1.xls'
    # ex_file = os.path.join(BASE_DIR, ex_name)
    ex = ExcelOp(ex_file=ex_name)
    ex.excel_run()

